#ifndef SIGNALFLOWCONTROLBOXES_H_JM_20121003
#define SIGNALFLOWCONTROLBOXES_H_JM_20121003

#include "../RootBox.h"

namespace jm4bbx {

	class  SignalCrossBoxTemplate : public RootBox {
	public:
		SignalCrossBoxTemplate(const BoxParamPack& pack) 
			: RootBox(pack) { }

		virtual void initImpl() override {
			wait4SignalsIn();
		}

		virtual void syncMachEtwas() override {
			sendSignalsOut();
			wait4SignalsIn();
		}
	};


	// cross 


	class SignalCrossBox : 
		public SignalCrossBoxTemplate {
	public:
		SignalCrossBox(const BoxParamPack& pack) 
			: SignalCrossBoxTemplate(pack) { }

	};

	// merge

	class SignalMergeBox : 
		public SignalCrossBoxTemplate {
	public:
		SignalMergeBox(const BoxParamPack& pack) 
			: SignalCrossBoxTemplate(pack) {

				// Natvrdo len jeden vystrupny signal je to merge
				// inak je mozne pouzit SignalCrossBox.
				setSignalsOut(1);
		}
	};

	// fork


	class SignalForkBox : 
		public SignalCrossBoxTemplate {
	public:
		SignalForkBox(const BoxParamPack& pack) 
			: SignalCrossBoxTemplate(pack) {

				// Natvrdo len jeden vstupny signal je to fork 
				// inak je mozne pouzit SignalCrossBox.
				setSignalsIn(1);
		}
	};

} // namespace jm4bbx


#endif
